package com.yupi.yu_picture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.yu_picture.model.dto.space.SpaceAddRequest;
import com.yupi.yu_picture.model.dto.space.SpaceQueryRequest;
import com.yupi.yu_picture.model.entity.Space;
import com.yupi.yu_picture.model.entity.User;
import com.yupi.yu_picture.model.vo.SpaceVO;


import javax.servlet.http.HttpServletRequest;

public interface SpaceService extends IService<Space> {
    /**
     * 验证空间
     * @param space
     * @param add
     */
    void validSpace(Space space, boolean add);

    /**
     * 填充空间字段
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 用户创建私有空间
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    Long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);


    /**
     * 获取查询对象
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * space->vo脱敏
     *
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 空间列表脱敏
     *
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

}
